package ProxyTest;

import java.lang.reflect.Proxy;

public class ImplementationFactory {
    /**
     * 工厂方法
     */
    public static <T> T create(Object target){
        ProxyFactory proxy = new ProxyFactory();
        proxy.setTarget(target);
        return (T) Proxy.newProxyInstance(target.getClass().getClassLoader(),
                target.getClass().getInterfaces(),proxy);
    }
}
